﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace DtsExplorerProject.Helpers
{
    public partial class ElementEditorForm : Form
    {
        string opacityValue;
        public string FilePath { get; set; }

        private int rownuber;
        public int Rownumber 
        {
            get { return rownuber; }
            set 
            {
                rownuber = value;
                switch (culture)
                {
                    case "fr":
                        lblRowNumber.Text = string.Format("Numéro de ligne {0}", rownuber);
                        break;
                    case "en":
                        lblRowNumber.Text = string.Format("Row number {0}", rownuber);
                        break;
                    case "es":
                        lblRowNumber.Text = string.Format("Número de fila {0}", rownuber);
                        break;
                    case "de":
                        lblRowNumber.Text = string.Format("Zeilennummer {0}", rownuber);
                        break;
                    default:
                        lblRowNumber.Text = string.Format("Row number {0}", rownuber);
                        break;
                }

                
            }
        }

        public string PathValue 
        {
            get { return lblPathValue.Text; }
            set { lblPathValue.Text = value; } 
        }

        public string ValueTypeValue 
        {
            get { return lblValueTypeValue.Text; }
            set { lblValueTypeValue.Text = value; } 
        }


        public string ConfiguredTypeValue
        {
            get { return lblConfiguredTypeValue.Text; }
            set { lblConfiguredTypeValue.Text = value; } 
        }

        public string ConfiguredValue
        {
            get { return txtConfiguredValue.Text; }
            set { txtConfiguredValue.Text = value; }
        }

        public ElementEditorForm()
        {
            InitializeComponent();
            this.ShowInTaskbar = false;
        }
       
        #region buttons
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
        private void btnCancel_Click(object sender, EventArgs e)
        {
            txtConfiguredValue.Text = string.Empty;
        }

        private void btnApply_Click(object sender, EventArgs e)
        {
            bool result = DtsResourcesManager.UpdateValueNode(DtsResourcesManager.FilePath,
               ConfiguredTypeValue,
               PathValue,
               ValueTypeValue,
               ConfiguredValue);
            this.Dispose();
        }

       
#endregion

        private void cmbOpacity_SelectedIndexChanged(object sender, EventArgs e)
        {
            opacityValue = cmbOpacity.SelectedItem.ToString();
            switch (opacityValue)
            {
                case "100%":
                    this.Opacity = 1;
                    break;
                case "90%":
                    this.Opacity = .9;
                    break;
                case "80%":
                    this.Opacity = .8;
                    break;
                case "70%":
                    this.Opacity = .7;
                    break;
                case "60%":
                    this.Opacity = .6;
                    break;
                case "50%":
                    this.Opacity = .5;
                    break;
                case "40%":
                    this.Opacity = .4;
                    break;
                case "30%":
                    this.Opacity = .3;
                    break;
                case "20%":
                    this.Opacity = .2;
                    break;
                case "10%":
                    this.Opacity = .1;
                    break;
                default:
                    this.Opacity = 1;
                    break;
            }
        }
    }
}
